import { ObjCreate } from "../common/ObjCreate";
import { TilePanel } from "../equipment/TilePanel";
import { DramaLotteryDesRender } from "./DramaLotteryDesRender";
import { ScrollPolicy } from "../../../../fl/controls/ScrollPolicy";
import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
type int = number;
//class DramaLatteryDesPart
    
    export  class DramaLatteryDesPart /* flash.display.Sprite */
    {
        constructor(arg1: int)
        {
            
            this._type = arg1;
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            this._sp = new Object /* flash.display.Sprite */();
            this._sp.mouseEnabled = false;
            this._sbg = ObjCreate.createBg(0, 0, 633, 30, this._sp);
            ObjCreate.createBg(-1, -3, 636, 27, this._sp, "RbListHeader");
            this._stbm = ObjCreate.createBitmap("", 166, 4, this._sp);
            this._bm = ObjCreate.createBitmap("", 317, 2, this._sp);
            this._itemsList = new TilePanel();
            this._itemsList.columnWidth = 85;
            this._itemsList.rowHeight = 76;
            this._itemsList.setStyle("cellRenderer", DramaLotteryDesRender);
            this._itemsList.move(65, 50);
            this._itemsList.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._itemsList.verticalScrollPolicy = ScrollPolicy.OFF;
            this._sp.addChild(this._itemsList);
            this.addChild(this._sp);
            LoaderHelp.addResCallBack(ResFileConst.DramaLottery, this.onLoadBmResource);
            return;
        }

        /* internal  */onLoadBmResource(): void
        {
            this._stbm.bitmapData = GlobalClass.getBitmapData(ImagesConst.DramaLotteryDesc);
            if (this._type != 1) 
            {
                if (this._type != 2) 
                {
                    this._bm.bitmapData = GlobalClass.getBitmapData(ImagesConst.DramaLotteryElseType);
                }
                else 
                {
                    this._bm.bitmapData = GlobalClass.getBitmapData(ImagesConst.DramaLotteryJewelType);
                }
            }
            else 
            {
                this._bm.bitmapData = GlobalClass.getBitmapData(ImagesConst.DramaLotteryStrenthType);
            }
            return;
        }

        public setListArr(arg1: Array<any>): void
        {
            var loc1=Math.ceil(arg1.length / 6);
            if (loc1 == 0) 
            {
                loc1 = 1;
            }
            this._itemsList.setSize(510, loc1 * 76 + loc1 * this._itemsList.verticalGap);
            this._itemsList.dataProvider = new DataProvider(arg1);
            this._sbg.height = 50 + this._itemsList.height + 15;
            return;
        }

        public /* override */ get height(): number
        {
            return this._sbg.height + 10;
        }

        /* internal */ /* var */_sp: Object /* flash.display.Sprite */;

        /* internal */ /* var */_stbm: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_bm: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_type: int;

        /* internal */ /* var */_sbg: ScaleBitmap;

        /* internal */ /* var */_itemsList: TilePanel;
    }
